/**
* File: globals.h
* \brief Agent-related global variables, structures and enumerations.
*
* \author Instituto Superior Tecnico de Lisboa, Portugal
* \author Technical University of Lisbon, Portugal
* 
* \author Agentes Autonomos e Sistemas Multiagente
* \author Autonomous Agents and Multiagent Systems
* 
* \version	1.0
* \date		2006/2007
**/
#pragma once

#include "../engine.h"

namespace agents{
	//=============================================================================
	// Constants and defines
	//=============================================================================
	/** 
	* \brief Maximum agent name length.
	**/
#define AGENT_NAME_MAX_LENGTH 64 
	/** 
	* \brief Maximum chat message size.
	**/
#define MAX_MESSAGE_SIZE 256

	/** 
	* \brief Minimum distance to consider that no collision has occured.
	**/
#define MINIMUM_COLLISION_FREE_DISTANCE	2.0

	//=============================================================================
	// Enumerations
	//=============================================================================
	/** 
	* \brief Game start actions.
	**/
	class GameStartActions{
	public:
		enum Enumeration{
			/** Normal state. **/
			idle			= 1,
			/** Selecting team. **/
			teamSelect		= 2,
			/** Selecting class (model). **/
			classSelect		= 3,
		};
	};

	/** 
	* \brief Agent's body parts.
	**/
	class BodyPart{
	public:
		enum Enumeration{
			/** The pelvis. **/
			pelvis = 1,
			/** The spine. **/
			spine = 2,
			/** The spine 1. **/
			spine1 = 3,
			/** The spine 2. **/
			spine2 = 4,
			/** The spine 3. **/
			spine3 = 5,
			/** The neck. **/
			neck = 6,
			/** The head. **/
			head = 7,
			/** The left clavicle. **/
			l_clavicle = 9,
			/** The left upper arm. **/
			l_upperArm = 10,
			/** The left forearm. **/
			l_forearm = 11,
			/** The left hand. **/
			l_hand = 12,
			/** The left finger 0. **/
			l_finger0 = 13,
			/** The left finger 01. **/
			l_finger01 = 14,
			/** The left finger 1. **/
			l_finger1 = 15,
			/** The left finger 11. **/
			l_finger11 = 16,
			/** The left thigh. **/
			l_thigh = 40,
			/** The left calf. **/
			l_calf = 41,
			/** The left foot. **/
			l_foot = 42,
			/** The right clavicle. **/
			r_clavicle = 23,
			/** The right upper arm. **/
			r_upperArm = 24,
			/** The right forearm. **/
			r_forearm = 25,
			/** The right hand. **/
			r_hand = 26,
			/** The right finger 0. **/
			r_finger0 = 27,
			/** The right finger 01. **/
			r_finger01 = 28,
			/** The right finger 1. **/
			r_finger1 = 29,
			/** The right finger 11. **/
			r_finger11 = 30,
			/** The right thigh. **/
			r_thigh = 46,
			/** The right calf. **/
			r_calf = 47,
			/** The right foot. **/
			r_foot = 48
		};
	};

	//=============================================================================
	// Structures
	//=============================================================================
	/** 
	* \brief Records some player stats each frame and holds sound events playing.
	**/
	typedef struct Threat_s
	{
		/**
		* \brief Player used in the game.
		**/
		bool isUsed;
		/**
		* \brief Whether agent is alive.
		**/
		bool isAlive;
		/**
		* \brief The entity.
		**/
		edict_t *pEdict;
		/**
		* \brief The team.
		**/
		int team;
		/**
		* \brief Position in the world.
		**/
		Vector origin;
		/**
		* \brief Position sound was played.
		**/
		Vector soundPosition;
		/**
		* \brief Distance this sound is heared.
		**/
		float hearingDistance;
		/**
		* \brief Time sound is played/heared.
		**/ 
		float timeSoundLasting;
	} Threat;


	//=============================================================================
	// Global variables
	//=============================================================================
	/** 
	* \brief Player information.
	**/
	extern Threat g_threatTab[32];
	/** 
	* \brief Maximum number of agents.
	**/
	extern int g_agentQuota;
	/** 
	* \brief Whether to autovacate.
	**/
	extern bool g_agentAutoVacate;
	/** 
	* \brief Last agent creation time.
	**/
	extern float g_agentCreationTime;
	/** 
	* \brief Whether radio communication is allowed.
	**/
	extern bool g_radioCommunicationActive;
	/** 
	* \brief Radio selection menu. 
	**/
	extern int g_radioSelect[32];
}